<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ext4yii xmlns:ext="http://www.w3.org/1999/xhtml" xmlns:prop="http://www.w3.org/1999/xhtml"/>

<ext:ScriptManager
    afterinitscript="ext4yii._Authentication.showLoginWindow()"
    <?php echo (isset($theme) && !is_null($theme)) ? "theme=\"$theme\"" : ""; ?>
    />
<ext:Window id="loginWindow"
            collapsible="false"
            closable="false"
            resizable="false"
            iconcls="IconLock"
            draggable="false"
            width="350"
            height="180"
            modal="true"
            title="<%=Ext4Yii::t('ext4yii_auth','Login')%>">
    <prop:Body>
        <div style="padding:10px;text-align:center;font-size:22px;background-color: white;border-bottom: silver solid 1px"><?php echo Yii::app()->name ?></div>
        <ext:FormPanel bodystyle="background-color: transparent;padding:5px"
                       id="loginForm"
                       width="335"
                       frame="false" border="false">
            <prop:Form>
                <ext:BasicForm controllername="<?php echo $controller ?>"/>
            </prop:Form>
            <prop:Body>
                <ext:FormLayout>
                    <prop:Anchors>
                        <ext:Anchor horizontal="100%">
                            <prop:Body>
                                <ext:TextField id="txtUsername" name="username"
                                               fieldlabel="<%=Ext4Yii::t('ext4yii_auth','Account')%>"
                                               blanktext="<%=Ext4Yii::t('ext4yii_auth','Account cannot be empty!')%>"
                                               allowblank="false"/>
                            </prop:Body>
                        </ext:Anchor>
                        <ext:Anchor horizontal="100%">
                            <prop:Body>
                                <ext:TextField id="txtPassword" name="password" fieldlabel="<%=Ext4Yii::t('ext4yii_auth','Password')%>" inputtype="password">
                                    <prop:Actions>
                                        <ext:ClientAction onevent="specialkey">
                                            <prop:Handler>
                                                <script>
                                                    if(this.getForm().isValid() &&  e.getKey() == Ext.EventObject.ENTER)
                                                    {
                                                        btnSubmit.fireEvent('click');
                                                    }
                                                </script>
                                            </prop:Handler>
                                        </ext:ClientAction>
                                    </prop:Actions>
                                </ext:TextField>
                            </prop:Body>
                        </ext:Anchor>
                    </prop:Anchors>
                </ext:FormLayout>
            </prop:Body>
        </ext:FormPanel>
    </prop:Body>
    <prop:Buttons>
        <ext:Button id="btnSubmit" text="<%=Ext4Yii::t('ext4yii_auth','Login')%>" iconcls="IconAccept">
            <prop:Actions>
                <ext:ClientAction onevent="click" handler="ext4yii._Authentication.startAuthentication()"/>                
            </prop:Actions>
        </ext:Button>
    </prop:Buttons>
</ext:Window>

